package com.example.cloudindex.web;

import com.example.cloudindex.entity.User;
import com.example.cloudindex.web.impl.OderActionImpl;
import com.sun.deploy.panel.ITreeNode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * 1.feign 远程调用是发送的post请求
 * 2.方法参数，默认会转为body 内容
 * 3.对于简单类型(字符串 ,int )可以通过@RequestParam标注 ， 实现传递
 * @RequestParam 只需要在发送端标注
 * 4.对于复杂类型(实体类)，必须在发送端和接受端都要标注
 */

@FeignClient(value = "cloud-order" , fallback = OderActionImpl.class)
public interface IOrderAction {

    @RequestMapping("order")
    String order();

    @RequestMapping("hello")
    String hello(@RequestParam String name);

    @RequestMapping("add")
    int add(@RequestParam int a, @RequestParam int b );

    @RequestMapping("user")
    User user(@RequestBody User user);
}
